package com.changgou.order.listener;

import com.changgou.order.config.RabbitMQConfig;
import com.changgou.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OrderTimeOutListener {

    @Autowired
    private OrderService orderService;

    //监听死信队列,执行关闭订单操作
    @RabbitListener(queues = RabbitMQConfig.QUEUE_ORDER_TIMEOUT)
    public void receiveMessage(String message){
        orderService.closeOrder(message);
    }
}
